package com.pda.gongpin.adapter;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.pda.gongpin.R;
import com.pda.gongpin.bean.FullTrayInDetailBean;
import com.wangshen.base.ui.mvp.base.adapter.BaseAdapter;

import java.util.List;

public class FullTrayInDetailListAdapter extends BaseAdapter<FullTrayInDetailBean.ListBean> {
    public FullTrayInDetailListAdapter(int layoutResId, @Nullable List<FullTrayInDetailBean.ListBean> data) {
        super(layoutResId, data);
        addChildClickViewIds(R.id.tv_state);
    }

    @Override
    protected void convert(BaseViewHolder helper, FullTrayInDetailBean.ListBean item) {
        super.convert(helper, item);
        helper.setText(R.id.tv_supplierName,"上架库位："+item.getStorageBinId());
        helper.setText(R.id.tv_entryTypeName,"上架数量："+item.getInNumStr());
        helper.setText(R.id.tv_user,"容器：     "+item.getContainer());
        helper.setText(R.id.tv_status,item.getCarryStatusStr());
        helper.setVisible(R.id.tv_state,true);
        if (item.getCarryStatus().equals("10")){
            helper.setText(R.id.tv_state,"删除");
            helper.setBackgroundColor(R.id.tv_state,getContext().getResources().getColor(R.color._FF5D5D));
        }else if (item.getCarryStatus().equals("40")){
            helper.setText(R.id.tv_state,"下架");
            helper.setBackgroundColor(R.id.tv_state,getContext().getResources().getColor(R.color._F5A623));
        }else {
            helper.setVisible(R.id.tv_state,false);
        }
    }
}
